load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")

go_library(
    name = "go_default_library",
    srcs = ["main.go"],
    importpath = "github.com/amaizfinance/redis-operator/cmd/manager",
    visibility = ["//visibility:private"],
    deps = [
        "//pkg/apis:go_default_library",
        "//pkg/controller:go_default_library",
        "//vendor/github.com/operator-framework/operator-sdk/pkg/k8sutil:go_default_library",
        "//vendor/github.com/operator-framework/operator-sdk/pkg/kube-metrics:go_default_library",
        "//vendor/github.com/operator-framework/operator-sdk/pkg/leader:go_default_library",
        "//vendor/github.com/operator-framework/operator-sdk/pkg/log/zap:go_default_library",
        "//vendor/github.com/operator-framework/operator-sdk/pkg/metrics:go_default_library",
        "//vendor/github.com/operator-framework/operator-sdk/pkg/restmapper:go_default_library",
        "//vendor/github.com/operator-framework/operator-sdk/version:go_default_library",
        "//vendor/github.com/spf13/pflag:go_default_library",
        "//vendor/k8s.io/api/core/v1:go_default_library",
        "//vendor/k8s.io/apimachinery/pkg/util/intstr:go_default_library",
        "//vendor/k8s.io/client-go/plugin/pkg/client/auth:go_default_library",
        "//vendor/k8s.io/client-go/rest:go_default_library",
        "//vendor/sigs.k8s.io/controller-runtime/pkg/client/config:go_default_library",
        "//vendor/sigs.k8s.io/controller-runtime/pkg/manager:go_default_library",
        "//vendor/sigs.k8s.io/controller-runtime/pkg/runtime/log:go_default_library",
        "//vendor/sigs.k8s.io/controller-runtime/pkg/runtime/signals:go_default_library",
        "//version:go_default_library",
    ],
)

go_binary(
    name = "manager",
    embed = [":go_default_library"],
    visibility = ["//visibility:public"],
)

load("@io_bazel_rules_docker//go:image.bzl", "go_image")

go_image(
    name = "manager_image",
    embed = [":go_default_library"],
    pure = "on",
    visibility = ["//visibility:public"],
)

load("@io_bazel_rules_docker//container:container.bzl", "container_push")

container_push(
    name = "push_manager_image",
    format = "Docker",
    image = ":manager_image",
    registry = "index.docker.io",
    repository = "amaiz/redis-operator",
    tag = "{ImageTag}",
)
